#include "styles.h"
#include "images.h"
#include "fonts.h"

#include "ui.h"
#include "screens.h"

//
// Style: menu_buotton_style
//

void init_style_menu_buotton_style_MAIN_DEFAULT(lv_style_t *style) {
    lv_style_set_bg_color(style, lv_color_hex(0xff311a6e));
    lv_style_set_flex_main_place(style, LV_FLEX_ALIGN_CENTER);
    lv_style_set_flex_cross_place(style, LV_FLEX_ALIGN_CENTER);
    lv_style_set_text_color(style, lv_color_hex(0xffd2f121));
};

lv_style_t *get_style_menu_buotton_style_MAIN_DEFAULT() {
    static lv_style_t *style;
    if (!style) {
        style = lv_mem_alloc(sizeof(lv_style_t));
        lv_style_init(style);
        init_style_menu_buotton_style_MAIN_DEFAULT(style);
    }
    return style;
};

void add_style_menu_buotton_style(lv_obj_t *obj) {
    (void)obj;
    lv_obj_add_style(obj, get_style_menu_buotton_style_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};

void remove_style_menu_buotton_style(lv_obj_t *obj) {
    (void)obj;
    lv_obj_remove_style(obj, get_style_menu_buotton_style_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};

//
// Style: inactive_button
//

void init_style_inactive_button_MAIN_DEFAULT(lv_style_t *style) {
    lv_style_set_shadow_width(style, 0);
    lv_style_set_radius(style, 0);
    lv_style_set_bg_color(style, lv_color_hex(0xffbbe1fa));
    lv_style_set_text_font(style, &ui_font_cn);
};

lv_style_t *get_style_inactive_button_MAIN_DEFAULT() {
    static lv_style_t *style;
    if (!style) {
        style = lv_mem_alloc(sizeof(lv_style_t));
        lv_style_init(style);
        init_style_inactive_button_MAIN_DEFAULT(style);
    }
    return style;
};

void add_style_inactive_button(lv_obj_t *obj) {
    (void)obj;
    lv_obj_add_style(obj, get_style_inactive_button_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};

void remove_style_inactive_button(lv_obj_t *obj) {
    (void)obj;
    lv_obj_remove_style(obj, get_style_inactive_button_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};

//
// Style: tab_panel
//

void init_style_tab_panel_MAIN_DEFAULT(lv_style_t *style) {
    lv_style_set_border_width(style, 0);
    lv_style_set_radius(style, 0);
    lv_style_set_pad_top(style, 0);
    lv_style_set_pad_bottom(style, 0);
    lv_style_set_pad_left(style, 0);
    lv_style_set_pad_right(style, 0);
};

lv_style_t *get_style_tab_panel_MAIN_DEFAULT() {
    static lv_style_t *style;
    if (!style) {
        style = lv_mem_alloc(sizeof(lv_style_t));
        lv_style_init(style);
        init_style_tab_panel_MAIN_DEFAULT(style);
    }
    return style;
};

void add_style_tab_panel(lv_obj_t *obj) {
    (void)obj;
    lv_obj_add_style(obj, get_style_tab_panel_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};

void remove_style_tab_panel(lv_obj_t *obj) {
    (void)obj;
    lv_obj_remove_style(obj, get_style_tab_panel_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};

//
// Style: back_button
//

void init_style_back_button_MAIN_DEFAULT(lv_style_t *style) {
    lv_style_set_bg_color(style, lv_color_hex(0xfff5f5f5));
    lv_style_set_shadow_opa(style, 0);
    lv_style_set_text_color(style, lv_color_hex(0xff000000));
    lv_style_set_text_font(style, &ui_font_cn);
    lv_style_set_radius(style, 0);
};

lv_style_t *get_style_back_button_MAIN_DEFAULT() {
    static lv_style_t *style;
    if (!style) {
        style = lv_mem_alloc(sizeof(lv_style_t));
        lv_style_init(style);
        init_style_back_button_MAIN_DEFAULT(style);
    }
    return style;
};

void add_style_back_button(lv_obj_t *obj) {
    (void)obj;
    lv_obj_add_style(obj, get_style_back_button_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};

void remove_style_back_button(lv_obj_t *obj) {
    (void)obj;
    lv_obj_remove_style(obj, get_style_back_button_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};

//
// Style: active_button
//

void init_style_active_button_MAIN_DEFAULT(lv_style_t *style) {
    lv_style_set_bg_color(style, lv_color_hex(0xfff5f5f5));
    lv_style_set_shadow_opa(style, 0);
    lv_style_set_text_font(style, &ui_font_cn);
    lv_style_set_radius(style, 0);
    lv_style_set_text_color(style, lv_color_hex(0xff000000));
};

lv_style_t *get_style_active_button_MAIN_DEFAULT() {
    static lv_style_t *style;
    if (!style) {
        style = lv_mem_alloc(sizeof(lv_style_t));
        lv_style_init(style);
        init_style_active_button_MAIN_DEFAULT(style);
    }
    return style;
};

void add_style_active_button(lv_obj_t *obj) {
    (void)obj;
    lv_obj_add_style(obj, get_style_active_button_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};

void remove_style_active_button(lv_obj_t *obj) {
    (void)obj;
    lv_obj_remove_style(obj, get_style_active_button_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};

//
// Style: default_lab
//

void init_style_default_lab_MAIN_DEFAULT(lv_style_t *style) {
    lv_style_set_text_color(style, lv_color_hex(0xff000000));
    lv_style_set_text_font(style, &ui_font_cn);
    lv_style_set_align(style, LV_ALIGN_CENTER);
};

lv_style_t *get_style_default_lab_MAIN_DEFAULT() {
    static lv_style_t *style;
    if (!style) {
        style = lv_mem_alloc(sizeof(lv_style_t));
        lv_style_init(style);
        init_style_default_lab_MAIN_DEFAULT(style);
    }
    return style;
};

void add_style_default_lab(lv_obj_t *obj) {
    (void)obj;
    lv_obj_add_style(obj, get_style_default_lab_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};

void remove_style_default_lab(lv_obj_t *obj) {
    (void)obj;
    lv_obj_remove_style(obj, get_style_default_lab_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};

//
//
//

void add_style(lv_obj_t *obj, int32_t styleIndex) {
    typedef void (*AddStyleFunc)(lv_obj_t *obj);
    static const AddStyleFunc add_style_funcs[] = {
        add_style_menu_buotton_style,
        add_style_inactive_button,
        add_style_tab_panel,
        add_style_back_button,
        add_style_active_button,
        add_style_default_lab,
    };
    add_style_funcs[styleIndex](obj);
}

void remove_style(lv_obj_t *obj, int32_t styleIndex) {
    typedef void (*RemoveStyleFunc)(lv_obj_t *obj);
    static const RemoveStyleFunc remove_style_funcs[] = {
        remove_style_menu_buotton_style,
        remove_style_inactive_button,
        remove_style_tab_panel,
        remove_style_back_button,
        remove_style_active_button,
        remove_style_default_lab,
    };
    remove_style_funcs[styleIndex](obj);
}

